# Maintainer:  Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=perl-test-mockmodule
_pkgname=Test-MockModule
pkgver=0.173.0
pkgrel=0
pkgdesc="Override subroutines in a module for unit testing"
url="https://metacpan.org/release/Test-MockModule"
arch="noarch"
license="GPL-1.0-or-later OR Artistic-1.0-Perl"
depends="perl"
makedepends="perl-dev perl-module-build perl-test-warnings perl-super
	perl-sub-identify"
subpackages="$pkgname-doc"
source="https://cpan.metacpan.org/authors/id/G/GF/GFRANKS/Test-MockModule-v$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-v$pkgver"

prepare() {
	default_prepare
	export CFLAGS=$(perl -MConfig -E 'say $Config{ccflags}')
	PERL_MM_USE_DEFAULT=1 perl Build.PL installdirs=vendor prefix=/usr
}

build() {
	export CFLAGS=$(perl -MConfig -E 'say $Config{ccflags}')
	PERL_MM_USE_DEFAULT=1 perl Build
}

check() {
	PERL_MM_USE_DEFAULT=1 perl Build test
}

package() {
	PERL_MM_USE_DEFAULT=1 perl Build install destdir="$pkgdir"
	find "$pkgdir" \( -name perllocal.pod -o -name .packlist \) -delete
}

sha512sums="45aa0a224f406f675ce17d8a62c40cdacf8aea88bb826a0404017f464346fb9177a720a8687449a03bc5593d4df52c45fc2c43a5c70d80aabede7d41e6f5a02a  Test-MockModule-v0.173.0.tar.gz"
